//package com.csw.security.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.core.authority.AuthorityUtils;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
//
///**
// * 自定义加密方式
// * @author shengwencheng
// * @Date 2021-10-30
// */
//
//@Configuration
//public class WebSecurityConfig2 extends WebSecurityConfigurerAdapter {
//
//    @Bean
//    @Override
//    protected UserDetailsService userDetailsService()
//    {
//        return new UserDetailsService() {
//            @Override
//            public UserDetails loadUserByUsername(String username) throws
//                    UsernameNotFoundException {
//                String pw = passwordEncoder().encode("123456");
//                return new User("chengsw", pw,
//                        AuthorityUtils.commaSeparatedStringToAuthorityList("admin,user"));
//            }
//        };
//    }
//    @Bean
//    public PasswordEncoder passwordEncoder() {
//        //return NoOpPasswordEncoder.getInstance();
//        return new BCryptPasswordEncoder();
//    }
//}
